/**
 *
 */
package gui;

import helden.plugin.werteplugin2.PluginHeld2;

import javax.swing.JPanel;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import javax.swing.JTable;
import java.awt.GridBagConstraints;

import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import javax.swing.JScrollPane;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultListModel;
import javax.swing.DropMode;
import javax.swing.JTextArea;
import javax.swing.JList;
import javax.swing.JLabel;
import javax.swing.ListSelectionModel;
import javax.swing.JComboBox;
import javax.swing.JButton;

import backend.AktiverZauber;

import main.Controller;

/**
 * @author Christian
 * 
 */
public class HauptFenster extends JPanel {
	
	/**
         *
         */
	private static final long serialVersionUID = -2744959501299830278L;
	
	/**
	 * 
	 */
	private ZauberTableModel tableModel = null;
	
	/**
	 * 
	 */
	private JScrollPane jScrollPane = null;
	
	/**
	 * 
	 */
	private JTable jZauberTable = null;
	
	/**
	 * 
	 */
	private JTextArea jKommentarTextArea = null;
	
	/**
	 * 
	 */
	private JList jAllgemeinList = null;
	
	/**
	 * 
	 */
	private JList jHeldenList = null;
	
	/**
	 * 
	 */
	private JLabel jLabel = null;
	
	/**
	 * 
	 */
	private JScrollPane jScrollPane2 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel1 = null;
	
	/**
	 * 
	 */
	private JComboBox jZauberFilterComboBox = null;
	
	/**
	 * 
	 */
	private JLabel jLabel2 = null;
	
	/**
	 * 
	 */
	private JTextArea jAnmerkungTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jWirkungsDauerTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jKostenTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jZauberDauerTextArea = null;
	
	/**
	 * 
	 */
	private JTextArea jReichweiteTextArea = null;
	
	/**
	 * 
	 */
	private JLabel jLabel3 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel4 = null;
	
	/**
	 * 
	 */
	private JList jBesondereList = null;
	
	/**
	 * 
	 */
	private JLabel jLabel5 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel6 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel7 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel8 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel9 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel10 = null;
	
	/**
	 * 
	 */
	private JLabel jLabel11 = null;
	
	/**
	 * 
	 */
	private JButton jRemoveBesondereButton = null;
	
	/**
	 * 
	 */
	private JButton jRemoveAllgemeinButton = null;
	
	/**
	 * 
	 */
	private JScrollPane jScrollPane1 = null;
	
	/**
	 * 
	 */
	private JScrollPane jScrollPane3 = null;
	
	/**
	 * 
	 */
	private JPanel jPanel = null;
	
	/**
	 * 
	 */
	private JButton jButton = null;
	
	/**
	 * 
	 */
	private JButton jButton1 = null;
	
	/**
	 * 
	 */
	private ListTransferHandler listTransHandler = null;
	
	/**
	 * 
	 */
	public HauptFenster() {

		tableModel = new ZauberTableModel(this);
		initialize();
	}
	
	/**
	 * Methode zum Aufbauen des Guis
	 */
	private void initialize() {

		GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
		gridBagConstraints21.gridx = 4;
		gridBagConstraints21.gridheight = 8;
		gridBagConstraints21.gridwidth = 2;
		gridBagConstraints21.gridy = 6;
		gridBagConstraints21.insets = new Insets(0, 50, 0, 0);
		gridBagConstraints21.fill = GridBagConstraints.BOTH;
		GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
		gridBagConstraints24.fill = GridBagConstraints.BOTH;
		gridBagConstraints24.gridy = 2;
		gridBagConstraints24.weightx = 1.0;
		gridBagConstraints24.weighty = 1.0;
		gridBagConstraints24.insets = new Insets(0, 25, 0, 0);
		gridBagConstraints24.gridheight = 3;
		gridBagConstraints24.gridx = 4;
		GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
		gridBagConstraints22.fill = GridBagConstraints.BOTH;
		gridBagConstraints22.gridy = 1;
		gridBagConstraints22.weightx = 1.0;
		gridBagConstraints22.weighty = 1.0;
		gridBagConstraints22.gridx = 2;
		GridBagConstraints gridBagConstraints211 = new GridBagConstraints();
		gridBagConstraints211.fill = GridBagConstraints.BOTH;
		gridBagConstraints211.gridy = 10;
		gridBagConstraints211.weightx = 1.0;
		gridBagConstraints211.weighty = 1.0;
		gridBagConstraints211.gridheight = 4;
		gridBagConstraints211.gridwidth = 2;
		gridBagConstraints211.insets = new Insets(5, 5, 5, 5);
		gridBagConstraints211.gridx = 0;
		GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
		gridBagConstraints20.gridx = 0;
		gridBagConstraints20.gridy = 9;
		gridBagConstraints20.insets = new Insets(5, 5, 5, 5);
		GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
		gridBagConstraints19.fill = GridBagConstraints.BOTH;
		gridBagConstraints19.gridy = 7;
		gridBagConstraints19.weightx = 1.0;
		gridBagConstraints19.insets = new Insets(5, 5, 5, 5);
		gridBagConstraints19.weighty = 1.0;
		gridBagConstraints19.gridheight = 2;
		gridBagConstraints19.gridwidth = 2;
		gridBagConstraints19.gridx = 0;
		GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
		gridBagConstraints18.gridx = 0;
		gridBagConstraints18.gridy = 5;
		gridBagConstraints18.insets = new Insets(5, 5, 5, 5);
		GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
		gridBagConstraints16.gridx = 1;
		gridBagConstraints16.gridy = 5;
		jLabel11 = new JLabel();
		jLabel11.setText("Allgemein:");
		jLabel10 = new JLabel();
		jLabel10.setText("Kommentar:");
		jLabel9 = new JLabel();
		jLabel9.setText("Anmerkung:");
		jLabel8 = new JLabel();
		jLabel8.setText("Kosten:");
		jLabel7 = new JLabel();
		jLabel7.setText("Zauberdauer:");
		jLabel6 = new JLabel();
		jLabel6.setText("Wirkungsdauer:");
		jLabel5 = new JLabel();
		jLabel5.setText("Reichweite:");
		GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
		gridBagConstraints81.gridx = 1;
		gridBagConstraints81.gridy = 9;
		jLabel4 = new JLabel();
		jLabel4.setText("Zauberspezifisch:");
		GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
		gridBagConstraints71.gridx = 4;
		gridBagConstraints71.gridy = 5;
		jLabel3 = new JLabel();
		jLabel3.setText("Zauberinfo");
		GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
		gridBagConstraints51.fill = GridBagConstraints.HORIZONTAL;
		gridBagConstraints51.gridy = 0;
		gridBagConstraints51.weightx = 1.0;
		gridBagConstraints51.insets = new Insets(5, 5, 5, 5);
		gridBagConstraints51.weighty = 1.0;
		gridBagConstraints51.gridx = 4;
		GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
		gridBagConstraints10.gridx = 0;
		gridBagConstraints10.gridy = 3;
		jLabel2 = new JLabel();
		jLabel2.setText("Zaubername: ");
		GridBagConstraints gridBagConstraintsZauberFilter = new GridBagConstraints();
		gridBagConstraintsZauberFilter.fill = GridBagConstraints.VERTICAL;
		gridBagConstraintsZauberFilter.gridy = 3;
		gridBagConstraintsZauberFilter.weightx = 1.0;
		gridBagConstraintsZauberFilter.gridx = 1;
		gridBagConstraintsZauberFilter.insets = new Insets(10, 0, 10, 0);
		GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
		gridBagConstraints8.gridx = 4;
		gridBagConstraints8.gridy = 0;
		jLabel1 = new JLabel();
		jLabel1.setText("Zaubertabelle");
		GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
		gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL;
		gridBagConstraints7.gridy = 2;
		gridBagConstraints7.weightx = 1.0;
		gridBagConstraints7.weighty = 1.0;
		gridBagConstraints7.gridwidth = 2;
		gridBagConstraints7.gridx = 0;
		gridBagConstraints7.insets = new Insets(10, 10, 10, 10);
		GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
		gridBagConstraints5.gridx = 1;
		gridBagConstraints5.gridy = 0;
		gridBagConstraints5.insets = new Insets(10, 5, 5, 5);
		jLabel = new JLabel();
		jLabel.setText("Helden");
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
		gridBagConstraints1.fill = GridBagConstraints.BOTH;
		gridBagConstraints1.gridy = 5;
		gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
		gridBagConstraints1.weightx = 1.0;
		gridBagConstraints1.weighty = 1.0;
		gridBagConstraints1.gridx = 4;
		this.setLayout(new GridBagLayout());
		this.setSize(new Dimension(654, 444));
		this.add(jLabel, gridBagConstraints5);
		this.add(getJScrollPane2(), gridBagConstraints7);
		this.add(jLabel1, gridBagConstraints8);
		this.add(getJZauberFilterComboBox(), gridBagConstraintsZauberFilter);
		this.add(jLabel2, gridBagConstraints10);
		this.add(jLabel3, gridBagConstraints71);
		this.add(jLabel4, gridBagConstraints81);
		this.add(jLabel11, gridBagConstraints16);
		this.add(getJRemoveAllgemeinButton(), gridBagConstraints18);
		this.add(getJScrollPane1(), gridBagConstraints19);
		this.add(getJRemoveBesondereButton(), gridBagConstraints20);
		this.add(getJScrollPane3(), gridBagConstraints211);
		this.add(getJScrollPane(), gridBagConstraints24);
		this.add(getJPanel(), gridBagConstraints21);
	}
	
	/**
	 * 
	 * @return Gibt das Hauptfenster zurück
	 */
	private HauptFenster getHauptFenster() {

		return this;
	}
	
	/**
	 * 
	 * @return Gibt den ListtransferHandler zurück
	 */
	public ListTransferHandler getListTransHandler() {

		return listTransHandler;
	}
	
	/**
	 * 
	 * @param handler
	 *            setz den Listtransferhandler
	 */
	public void setListTransferHandler(ListTransferHandler handler) {

		listTransHandler = handler;
	}
	
	/**
	 * This method initializes jScrollPane
	 * 
	 * @return javax.swing.JScrollPane
	 */
	private JScrollPane getJScrollPane() {

		if (jScrollPane == null) {
			jScrollPane = new JScrollPane();
			jScrollPane.setPreferredSize(new Dimension(200, 200));
			jScrollPane.setViewportView(getJZauberTable());
		}
		return jScrollPane;
	}
	
	/**
	 * This method initializes jZauberTable
	 * 
	 * @return javax.swing.JTable
	 */
	public JTable getJZauberTable() {

		if (jZauberTable == null) {
			jZauberTable = new JTable(tableModel);
			jZauberTable.getSelectionModel().addListSelectionListener(
					new HauptFensterController(jZauberTable, this));
			TableRowSorter<TableModel> sorter 
		    = new TableRowSorter<TableModel>(jZauberTable.getModel());
			jZauberTable.setRowSorter(sorter);


			// zauberTableModel = new ZauberTableModel(this);
			TableColumnModel columns = jZauberTable.getColumnModel();
			for (int i = 0; i < jZauberTable.getColumnCount(); i++) {
				TableColumn column = columns.getColumn(i);
				switch (i) {
				case 0: // Helden Name
					column.setPreferredWidth(150);
					break;
				case 1: // Zauber
					column.setPreferredWidth(140);
					break;
				case 2: // Repräsentation
					column.setPreferredWidth(60);
					break;
				default:
					throw new IllegalArgumentException("Es gibt nur 3 Spalten.");
				}
				if (jZauberTable.getRowCount() > 0) {
					jZauberTable.getSelectionModel().setSelectionInterval(0, 0);
				}
			}
		}
		return jZauberTable;
	}
	
	/**
	 * This method initializes jKommentarTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJKommentarTextArea() {

		if (jKommentarTextArea == null) {
			jKommentarTextArea = new JTextArea(2, 30);
			jKommentarTextArea.setDragEnabled(true);
			jKommentarTextArea.setLineWrap(true);
		}
		return jKommentarTextArea;
	}
	
	/**
	 * This method initializes jAllgemeinList
	 * 
	 * @return javax.swing.JList
	 */
	private JList getJAllgemeinList() {

		if (jAllgemeinList == null) {
			DefaultListModel listModel = new DefaultListModel();
			jAllgemeinList = new JHauptfensterList(listModel);
			jAllgemeinList.setCellRenderer(new HauptFensterListCellRenderer());
			jAllgemeinList.setDragEnabled(true);
			jAllgemeinList.getSelectionModel().setSelectionMode(
					ListSelectionModel.SINGLE_SELECTION);
			jAllgemeinList.setTransferHandler(new ListTransferHandler(jAllgemeinList, "Alle",
					"Alle"));
			jAllgemeinList.setDropMode(DropMode.INSERT);
		}
		DefaultListModel model = ((DefaultListModel) jAllgemeinList.getModel());
		model.removeAllElements();
		for (String string : Controller.getDatenController().getDatenList("Alle", "Alle")) {
			model.addElement(string);
		}
		return jAllgemeinList;
	}
	
	/**
	 * This method initializes jHeldenList
	 * 
	 * @return javax.swing.JList
	 */
	public JList getJHeldenList() {

		if (jHeldenList == null) {
			DefaultListModel listModel = new DefaultListModel();
			listModel.addElement("Alle");
			for (PluginHeld2 held : Controller.getDatenController().getHelden()) {
				listModel.addElement(held.toString());
			}
			jHeldenList = new JHauptfensterList(listModel);
			// jHeldenList.setPreferredSize(new Dimension(150, 150));
			jHeldenList.setSelectedIndex(0);
			jHeldenList.setCellRenderer(new HauptFensterListCellRenderer());
			jHeldenList.addListSelectionListener(new ListSelectionListener() {
				
				public void valueChanged(ListSelectionEvent evt) {

					if (evt.getValueIsAdjusting()) {
						return;
					}
					tableModel.aktualisiere();
				}
			});
		}
		return jHeldenList;
	}
	
	/**
	 * This method initializes jScrollPane2
	 * 
	 * @return javax.swing.JScrollPane
	 */
	private JScrollPane getJScrollPane2() {

		if (jScrollPane2 == null) {
			jScrollPane2 = new JScrollPane();
			jScrollPane2.setPreferredSize(new Dimension(80, 150));
			jScrollPane2.setViewportView(getJHeldenList());
		}
		return jScrollPane2;
	}
	
	/**
	 * This method initializes jZauberFilterComboBox
	 * 
	 * @return javax.swing.JComboBox
	 */
	public JComboBox getJZauberFilterComboBox() {

		if (jZauberFilterComboBox == null) {
			jZauberFilterComboBox = new JComboBox();
			jZauberFilterComboBox.removeAllItems();
			jZauberFilterComboBox.addItem("Alle vorhanden");
			for (String name : Controller.getDatenController().getAlleAktivenZauberNamen()) {
				jZauberFilterComboBox.addItem(name);
			}
			jZauberFilterComboBox.addActionListener(new ActionListener() {
				
				public void actionPerformed(ActionEvent e) {

					tableModel.aktualisiere();
				}
			});
		}
		return jZauberFilterComboBox;
	}
	
	/**
	 * This method initializes jAnmerkungTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJAnmerkungTextArea() {

		if (jAnmerkungTextArea == null) {
			jAnmerkungTextArea = new JTextArea(2, 30);
			jAnmerkungTextArea.setDragEnabled(true);
			jAnmerkungTextArea.setLineWrap(true);
		}
		return jAnmerkungTextArea;
	}
	
	/**
	 * This method initializes jWirkungsDauerTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJWirkungsDauerTextArea() {

		if (jWirkungsDauerTextArea == null) {
			jWirkungsDauerTextArea = new JTextArea(2, 30);
			jWirkungsDauerTextArea.setDragEnabled(true);
			jWirkungsDauerTextArea.setLineWrap(true);
		}
		return jWirkungsDauerTextArea;
	}
	
	/**
	 * This method initializes jKostenTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJKostenTextArea() {

		if (jKostenTextArea == null) {
			jKostenTextArea = new JTextArea(2, 30);
			jKostenTextArea.setDragEnabled(true);
			jKostenTextArea.setLineWrap(true);
		}
		return jKostenTextArea;
	}
	
	/**
	 * This method initializes jZauberDauerTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJZauberDauerTextArea() {

		if (jZauberDauerTextArea == null) {
			jZauberDauerTextArea = new JTextArea(2, 30);
			jZauberDauerTextArea.setDragEnabled(true);
			jZauberDauerTextArea.setLineWrap(true);
		}
		return jZauberDauerTextArea;
	}
	
	/**
	 * This method initializes jReichweiteTextArea
	 * 
	 * @return javax.swing.JTextArea
	 */
	public JTextArea getJReichweiteTextArea() {

		if (jReichweiteTextArea == null) {
			jReichweiteTextArea = new JTextArea(2, 30);
			jReichweiteTextArea.setDragEnabled(true);
			jReichweiteTextArea.setLineWrap(true);
		}
		return jReichweiteTextArea;
	}
	
	/**
	 * This method initializes jBesondereList
	 * 
	 * @return javax.swing.JList
	 */
	public JList getJBesondereList() {

		if (jBesondereList == null) {
			DefaultListModel listModel = new DefaultListModel();
			jBesondereList = new JHauptfensterList(listModel);
			jBesondereList.setDragEnabled(true);
			jBesondereList.setCellRenderer(new HauptFensterListCellRenderer());
			jBesondereList.getSelectionModel().setSelectionMode(
					ListSelectionModel.SINGLE_SELECTION);
			int row = getJZauberTable().getSelectedRow();
			if (row >= 0) {
				AktiverZauber aktiverZauber = (AktiverZauber) getJZauberTable().getModel()
						.getValueAt(row, 1);
				String zauberName = aktiverZauber.getZauber().getZauberName();
				String repraesentation = aktiverZauber.getZauber().getRepraesentation();
				listTransHandler = new ListTransferHandler(jBesondereList, zauberName,
						repraesentation);
				jBesondereList.setTransferHandler(listTransHandler);
				jBesondereList.setDropMode(DropMode.INSERT);
			} else {
				jBesondereList.setEnabled(false);
			}
		}
		return jBesondereList;
	}
	
	/**
	 * This method initializes jRemoveBesondereButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJRemoveBesondereButton() {

		if (jRemoveBesondereButton == null) {
			jRemoveBesondereButton = new JButton();
			jRemoveBesondereButton.setText("-");
			jRemoveBesondereButton.setActionCommand("removefromlist-");
			jRemoveBesondereButton.addActionListener(new HauptFensterController(
					getJBesondereList(), "spez"));
		}
		return jRemoveBesondereButton;
	}
	
	/**
	 * This method initializes jRemoveAllgemeinButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJRemoveAllgemeinButton() {

		if (jRemoveAllgemeinButton == null) {
			jRemoveAllgemeinButton = new JButton();
			jRemoveAllgemeinButton.setText("-");
			jRemoveAllgemeinButton.setActionCommand("removefromlist-");
			jRemoveAllgemeinButton.addActionListener(new HauptFensterController(
					getJAllgemeinList(), "Alle"));
		}
		return jRemoveAllgemeinButton;
	}
	
	/**
	 * This method initializes jScrollPane1
	 * 
	 * @return javax.swing.JScrollPane
	 */
	private JScrollPane getJScrollPane1() {

		if (jScrollPane1 == null) {
			jScrollPane1 = new JScrollPane();
			jScrollPane1.setViewportView(getJAllgemeinList());
		}
		return jScrollPane1;
	}
	
	/**
	 * This method initializes jScrollPane3
	 * 
	 * @return javax.swing.JScrollPane
	 */
	private JScrollPane getJScrollPane3() {

		if (jScrollPane3 == null) {
			jScrollPane3 = new JScrollPane();
			jScrollPane3.setViewportView(getJBesondereList());
		}
		return jScrollPane3;
	}
	
	/**
	 * This method initializes jPanel
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel() {

		if (jPanel == null) {
			GridBagConstraints gridBagConstraints110 = new GridBagConstraints();
			gridBagConstraints110.gridx = 4;
			gridBagConstraints110.gridy = 6;
			GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
			gridBagConstraints23.gridx = 2;
			gridBagConstraints23.gridy = 6;
			gridBagConstraints23.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints27 = new GridBagConstraints();
			gridBagConstraints27.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints27.gridy = 0;
			gridBagConstraints27.weightx = 1.0;
			gridBagConstraints27.weighty = 1.0;
			gridBagConstraints27.gridx = 4;
			gridBagConstraints27.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints26 = new GridBagConstraints();
			gridBagConstraints26.fill = GridBagConstraints.BOTH;
			gridBagConstraints26.gridy = 5;
			gridBagConstraints26.weightx = 1.0;
			gridBagConstraints26.weighty = 1.0;
			gridBagConstraints26.gridx = 4;
			gridBagConstraints26.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
			gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints9.gridy = 1;
			gridBagConstraints9.weightx = 1.0;
			gridBagConstraints9.weighty = 1.0;
			gridBagConstraints9.gridx = 4;
			gridBagConstraints9.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints11.gridx = 4;
			gridBagConstraints11.gridy = 3;
			gridBagConstraints11.weightx = 1.0;
			gridBagConstraints11.weighty = 1.0;
			gridBagConstraints11.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.fill = GridBagConstraints.BOTH;
			gridBagConstraints2.gridx = 4;
			gridBagConstraints2.gridy = 4;
			gridBagConstraints2.weightx = 1.0;
			gridBagConstraints2.weighty = 1.0;
			gridBagConstraints2.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
			gridBagConstraints15.gridx = 2;
			gridBagConstraints15.gridy = 5;
			GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
			gridBagConstraints14.gridx = 2;
			gridBagConstraints14.gridy = 4;
			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
			gridBagConstraints13.gridx = 2;
			gridBagConstraints13.gridy = 3;
			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
			gridBagConstraints12.gridx = 2;
			gridBagConstraints12.gridy = 2;
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints4.gridx = 4;
			gridBagConstraints4.gridy = 2;
			gridBagConstraints4.weightx = 1.0;
			gridBagConstraints4.weighty = 1.0;
			gridBagConstraints4.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
			gridBagConstraints17.insets = new Insets(0, 10, 0, 0);
			gridBagConstraints17.gridy = 1;
			gridBagConstraints17.gridx = 2;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.gridx = 2;
			gridBagConstraints.gridy = 0;
			jPanel = new JPanel();
			jPanel.setLayout(new GridBagLayout());
			jPanel.add(jLabel5, gridBagConstraints);
			jPanel.add(jLabel6, gridBagConstraints17);
			jPanel.add(getJZauberDauerTextArea(), gridBagConstraints4);
			jPanel.add(jLabel7, gridBagConstraints12);
			jPanel.add(jLabel8, gridBagConstraints13);
			jPanel.add(jLabel9, gridBagConstraints14);
			jPanel.add(jLabel10, gridBagConstraints15);
			jPanel.add(getJAnmerkungTextArea(), gridBagConstraints2);
			jPanel.add(getJKostenTextArea(), gridBagConstraints11);
			jPanel.add(getJWirkungsDauerTextArea(), gridBagConstraints9);
			jPanel.add(getJKommentarTextArea(), gridBagConstraints26);
			jPanel.add(getJReichweiteTextArea(), gridBagConstraints27);
			jPanel.add(getJButton(), gridBagConstraints23);
			jPanel.add(getJButton1(), gridBagConstraints110);
		}
		return jPanel;
	}
	
	/**
	 * 
	 * @return Gibt das Zaubernamen JLabel zurück
	 */
	public JLabel getJLabel3() {

		return jLabel3;
	}
	
	/**
	 * This method initializes jButton
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJButton() {

		if (jButton == null) {
			jButton = new JButton();
			jButton.setText("speichern");
			jButton.addActionListener(new ActionListener() {
				
				public void actionPerformed(ActionEvent e) {

					int row = getJZauberTable().getSelectedRow();
					if (row >= 0) {
						AktiverZauber aktiverZauber = (AktiverZauber) getJZauberTable()
								.getModel().getValueAt(row, 1);
						Controller.getDatenController().inHeldenSpeichern(aktiverZauber,
								getHauptFenster());
					}
				}
			});
		}
		return jButton;
	}
	
	/**
	 * This method initializes jButton1
	 * 
	 * @return javax.swing.JButton
	 */
	private JButton getJButton1() {

		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setText("Infos auf andere Helden übertragen");
			jButton1.addActionListener(new ActionListener() {
				
				public void actionPerformed(ActionEvent e) {

					int index = getHauptFenster().getJZauberTable().getSelectedRow();
					if (index >= 0) {
						AktiverZauber aktiverZauber = (AktiverZauber) getJZauberTable()
								.getModel().getValueAt(index, 1);
						Controller.getDatenController().inHeldenSpeichern(aktiverZauber,
								getHauptFenster());
						Controller.getGuiController().zeigeUpdateAlleHelden(
								aktiverZauber.getZauber());
					}
				}
			});
		}
		return jButton1;
	}
} // @jve:decl-index=0:visual-constraint="31,27"
